package com.example.springaop.controller;

import com.example.springaop.aspect.MyAspect;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("test")
public class TestController {
    @RequestMapping("/t1")
    public String t1() {
        log.info("目标方法执行");
        return "hello";
    }

    @MyAspect
    @RequestMapping("/t2")
    public String t2() {
        log.info("我爱Java，我要成为Java高手");
        return "hello world";
    }

    @MyAspect
    @RequestMapping("/t3")
    public Integer t3() {
        log.info("目标方法2执行");
        Integer result = 10/0;
        return result;
    }
}
